﻿using UnityEngine;

namespace TC
{
    public class GetPosition : VariableNode
    {
        public ValueInput<GameObject> gameObject;
        public ValueOutput<Vector3> position;

        public override void OnCreate()
        {
            base.OnCreate();

            gameObject = this.AddValueInPort<GameObject>("gameObject");
            position = this.AddValueOutPort<Vector3>("position", () =>
            {
                GameObject tmp = gameObject.Value;
                if (tmp == null) return Vector3.zero;

                return tmp.transform.position;
            });
        }
    }
}
